﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using Microsoft.Xna.Framework;

namespace BrewXML.WindowsPhone.Converter
{
   public class SrmToColorConverter :IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            int srm = (int)value;
            if (srm == 0) return new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 255, 255));
            if (srm <= 5) return new SolidColorBrush(System.Windows.Media.Color.FromArgb(255,225, 208, 50));
            if (srm <= 10) return new SolidColorBrush(System.Windows.Media.Color.FromArgb(255,192, 129, 56));
            if (srm <= 15) return new SolidColorBrush(System.Windows.Media.Color.FromArgb(255,167, 91, 54));
            if (srm <= 20) return new SolidColorBrush(System.Windows.Media.Color.FromArgb(255,95, 53, 23));
            if (srm <= 25) return new SolidColorBrush(System.Windows.Media.Color.FromArgb(255,33, 19, 18));
            if (srm <= 30) return new SolidColorBrush(System.Windows.Media.Color.FromArgb(255,8, 3, 2));
            if (srm <= 50) return new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 6, 2, 1));
            return new SolidColorBrush(System.Windows.Media.Color.FromArgb(255,255,255,255));
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
